// 将main中关于路由的配置代码提取出来
import Vue from 'vue'
import VueRouter from 'vue-router'

// 导入路由级组件
import HoreList from './view/HoreList.vue'
import JnList from './view/JnList.vue'
import ZbList from './view/ZbList.vue'
import HoreAdd from './view/HoreAdd.vue'
import HoreEdit from './view/HoreEdit.vue'
// 使用插件
Vue.use(VueRouter);
// 配置路由规则
const routes = [
    {path:'/',redirect:'/hore'}
   ,{path:'/hore',component:HoreList}
   ,{path:'/hore/add',component:HoreAdd}
   ,{path:'/hore/edit/:id',component:HoreEdit}
   ,{path:'/zb',component:ZbList}
   ,{path:'/jn',component:JnList}
  ];
  // 初始化路由,并添加属性类名实现点击变色
const router = new VueRouter({routes,linkExactActiveClass:'active'})
// router需要在vue根实例下挂载
// 1. 导出 router 实例
// 2. 在main.js导入router实例，进行挂载即可
export default router